package group2assignone.ucm.manager;

import group2assignone.func.UCCtoALAdapter;
import group2assignone.model.Flight;
import group2assignone.ucm.UCController;
import group2assignone.view.manager.DeleteFlightView;

/**
 * use case to change ui to the delete flight view
 * @author group2
 */
public class UCUIDeleteFlight implements UCController {

    private DeleteFlightView deleteView = new DeleteFlightView();

    /**
     *
     * @param view
     */
    public UCUIDeleteFlight(DeleteFlightView view) {
        this.deleteView = view;
        deleteView.go();
    }

    @Override
    public void run() {
        Flight f = new Flight();
        //boolean exists = false;

        UCDeleteFlightSearch ucdfs = new UCDeleteFlightSearch(deleteView, f);
        deleteView.setSearchAL(new UCCtoALAdapter(ucdfs));

        UCDeleteFlightCancel ucdfc = new UCDeleteFlightCancel(deleteView);
        deleteView.setCancelAL(new UCCtoALAdapter(ucdfc));

        UCDeleteFlight ucdfd = new UCDeleteFlight(deleteView, f);
        deleteView.setDeleteAL(new UCCtoALAdapter(ucdfd));

        UCDeleteFlightBack ucdfb = new UCDeleteFlightBack(deleteView);
        deleteView.setBackAL(new UCCtoALAdapter(ucdfb));
    }
}
